package com.start.shop.api.vo.goods;

import java.util.Arrays;
import java.util.List;

import com.start.shop.modules.repository.entity.Goods;

import lombok.Data;

@Data
public class GoodsItemVo {
	private int goodsId;
    private int goodsType;
	private String goodsName;
	private String goodsTitle;
	private String goodsImg;
	private List<String> bannerImg;
	private List<String> goodsDesc;
	private int buyLimit;
	
	public static GoodsItemVo setdata(Goods goods) {
		
		GoodsItemVo goodsItemVo = new GoodsItemVo();
		goodsItemVo.setGoodsId(goods.getGoodsId());
		goodsItemVo.setGoodsImg(goods.getGoodsImg());
		goodsItemVo.setGoodsName(goods.getGoodsName());
		goodsItemVo.setGoodsTitle(goods.getGoodsTitle());
		goodsItemVo.setGoodsImg(goods.getGoodsImg());
		goodsItemVo.setBannerImg(Arrays.asList(goods.getBannerImg().split(",")));
		goodsItemVo.setGoodsDesc(Arrays.asList(goods.getGoodsDesc().split(",")));
		goodsItemVo.setBuyLimit(goods.getBuyLimit());

		return goodsItemVo;	
	}
}
